const path=require('path');
const Koa=require('koa');
const views=require('koa-views');
const app=new Koa();

app.use(views(path.join(__dirname,'views'),{
    extension:'ejs'
}));

app.use(async ctx=>{
    await ctx.render('index',{
        title:'Koa Ejs!!',
        content:'Hello Koa!!',
        time:new Date().toLocaleString()
    });
});

app.listen(4000,()=>{
   console.log(`[koa-views]:4000---${new Date().toLocaleTimeString()}`);
});